<?php
/**
 * House View for Congregation Component
 * 
 * @package    Congregation
 * @subpackage Components
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_4
 * @license		GNU/GPL
 */

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view' );

/**
 * House View
 *
 * @package    Congregation
 * @subpackage Components
 */
class CongregationViewHouse extends CongregationView
{
	/**
	 * Sharings view display method
	 * @return void
	 **/
	protected $_p_id;
	
	function __construct()
	{
		parent::__construct();

		// Register Extra tasks
	
		$this->_p_id = JRequest::getCmd('p_id');
	}

	
	
	function display($tpl = null)
	{
	
		// Get data from the model
		$house =& $this->get('Data');
		$houses =& $this->get('List');
		$provinces = & $this->get('Provinces');
		
		$isNew		= ($house->c_id < 1);
		$this->assignRef('house', $house);
		$this->assignRef('houses', $houses);
		$this->assignRef('provinces', $provinces);
		
		if($isNew)
		{
			JToolBarHelper::title(   JText::_( 'New House' ), 'generic.png' );
		}
		else
		{
			JToolBarHelper::title(   JText::_( 'Edit House' ), 'generic.png' );
		}
		JToolBarHelper::save();
		JToolBarHelper::back(JText::_('Back'), JRoute::_( 'index.php?option=com_congregation&controller=house&p_id=' . $this->_p_id));
		$editor = & JFactory::getEditor();
		$this->assignRef('editor',    $editor);		
		
		

		parent::display($tpl);
	}
	
}
